<!-- 
日期选择条组件 
使用方法：
<langbarcomponent></langbarcomponent>

import langbarcomponent from '@/pages/csm/components/langbarcomponent.vue'

components: {
	langbarcomponent
},

-->
<template>
	<view class="p-languagebar" @click="click">
		{{param.language_text}}
	</view>
</template>

<script>
	export default {
		props: {
			//默认值
			currentval: {
				type:String,
			},
		},
		data() {
			return {
				sp: {},
				param: {
					language:"",
					language_text:""
				},
				sr: {
				},
			}
		},
		created() {
			let that = this;
			that._initPage();
		},
		methods: {
			_initPage(isForceDisplay) {
				let that = this;
				that.param.language = that.$i18n.locale;
				that.param.language_text = that._getLanuageText(that.param.language);
			},
			click: function(e) {
				let that = this;
				that._change();
			},
			_change:function(){
				let that = this;
				//that.param.language_text = (that.param.language=="en")?"中文":"EN";
				that.param.language = (that.param.language=="en")?"zh":"en";
				that.param.language_text = that._getLanuageText(that.param.language);
				that.$i18n.locale = that.param.language;
				this.$emit('initPage',false,true);
			},
			_getLanuageText:function(language){
				return (language=='zh')?'EN':'中文';
			}
		}
	}
</script>

<style lang="scss">
	@import "@/static/assets/csm/css/core.scss";
	.p-languagebar {
		position: fixed;
		right: 10px;
		bottom: 100px;
		border: 1px solid $active-background-color;
		background-color: $page-background-color;
		color: $active-background-color;
		font-size: 14px;
		padding: 6px;
		border-radius: 10px;
		opacity:0.9;
	}
</style>
